{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Using TensorFlow backend.\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "import json\n",
    "from keras.models import Model\n",
    "from keras.layers import Input\n",
    "from keras.layers.convolutional import Conv2D\n",
    "from keras.layers.pooling import MaxPooling2D, AveragePooling2D\n",
    "from keras.layers.normalization import BatchNormalization\n",
    "from keras import backend as K\n",
    "from collections import OrderedDict"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "def format_decimal(arr, places=6):\n",
    "    return [round(x * 10**places) / 10**places for x in arr]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "DATA = OrderedDict()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### pipeline 6"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "random_seed = 1006\n",
    "data_in_shape = (24, 24, 2)\n",
    "\n",
    "layers = [\n",
    "    Conv2D(5, (3,3), activation='relu', padding='valid', strides=(2,2), data_format='channels_last', use_bias=True),\n",
    "    BatchNormalization(epsilon=1e-03, axis=-1, center=True, scale=True),\n",
    "    Conv2D(4, (3,3), activation='relu', padding='same', strides=(1,1), data_format='channels_last', use_bias=True),\n",
    "    BatchNormalization(epsilon=1e-03, axis=-1, center=True, scale=True),\n",
    "    Conv2D(3, (3,3), activation='relu', padding='same', strides=(1,1), data_format='channels_last', use_bias=True),\n",
    "    BatchNormalization(epsilon=1e-03, axis=-1, center=True, scale=True),\n",
    "    MaxPooling2D(pool_size=(2,2), strides=None, padding='valid', data_format='channels_last'),\n",
    "    Conv2D(4, (3,3), activation='linear', padding='valid', strides=(1,1), data_format='channels_last', use_bias=True),\n",
    "    BatchNormalization(epsilon=1e-03, axis=-1, center=True, scale=True),\n",
    "    Conv2D(2, (3,3), activation='relu', padding='same', strides=(1,1), data_format='channels_last', use_bias=True),\n",
    "    BatchNormalization(epsilon=1e-03, axis=-1, center=True, scale=True),\n",
    "    MaxPooling2D(pool_size=(2,2), strides=None, padding='valid', data_format='channels_last')\n",
    "]\n",
    "\n",
    "input_layer = Input(shape=data_in_shape)\n",
    "x = layers[0](input_layer)\n",
    "for layer in layers[1:-1]:\n",
    "    x = layer(x)\n",
    "output_layer = layers[-1](x)\n",
    "model = Model(inputs=input_layer, outputs=output_layer)\n",
    "\n",
    "np.random.seed(random_seed)\n",
    "data_in = 2 * np.random.random(data_in_shape) - 1\n",
    "\n",
    "# set weights to random (use seed for reproducibility)\n",
    "weights = []\n",
    "for i, w in enumerate(model.get_weights()):\n",
    "    np.random.seed(random_seed + i)\n",
    "    if i % 6 == 5:\n",
    "        # std should be positive\n",
    "        weights.append(0.5 * np.random.random(w.shape))\n",
    "    else:\n",
    "        weights.append(np.random.random(w.shape) - 0.5)\n",
    "model.set_weights(weights)\n",
    "\n",
    "result = model.predict(np.array([data_in]))\n",
    "data_out_shape = result[0].shape\n",
    "data_in_formatted = format_decimal(data_in.ravel().tolist())\n",
    "data_out_formatted = format_decimal(result[0].ravel().tolist())\n",
    "\n",
    "DATA['pipeline_06'] = {\n",
    "    'input': {'data': data_in_formatted, 'shape': data_in_shape},\n",
    "    'weights': [{'data': format_decimal(w.ravel().tolist()), 'shape': w.shape} for w in weights],\n",
    "    'expected': {'data': data_out_formatted, 'shape': data_out_shape}\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### export for Keras.js tests"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import os\n",
    "\n",
    "filename = '../../test/data/pipeline/06.json'\n",
    "if not os.path.exists(os.path.dirname(filename)):\n",
    "    os.makedirs(os.path.dirname(filename))\n",
    "with open(filename, 'w') as f:\n",
    "    json.dump(DATA, f)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{\"pipeline_06\": {\"input\": {\"data\": [0.486255, -0.547151, 0.285068, 0.764711, 0.481398, 0.442527, -0.409304, 0.051033, -0.652471, 0.623918, 0.698811, -0.48696, -0.525531, -0.083229, -0.54216, -0.595979, 0.965361, 0.961457, 0.469608, -0.18139, 0.237622, -0.841546, -0.201479, 0.210842, -0.099026, -0.017468, -0.270985, -0.421947, 0.990418, 0.633556, -0.46994, -0.283905, 0.339371, 0.851372, -0.963439, 0.672347, -0.592494, 0.115008, 0.77155, -0.629049, -0.284972, 0.08256, -0.526964, -0.579017, 0.048964, 0.296374, -0.503246, -0.95555, -0.759658, -0.148746, 0.527992, 0.419541, -0.601167, -0.246472, 0.611566, -0.47989, -0.796678, 0.845136, -0.929013, 0.081316, -0.965527, 0.064677, 0.687209, -0.781686, 0.556524, -0.294628, 0.343468, -0.693394, -0.864068, 0.522942, -0.854592, 0.954066, 0.352462, 0.404271, 0.935993, 0.006064, -0.614327, -0.951249, -0.974544, -0.981322, -0.524456, -0.353175, -0.283883, 0.270072, 0.336334, -0.529043, 0.880513, -0.663035, -0.709319, -0.69236, 0.233949, 0.90419, -0.721928, 0.580281, -0.149192, -0.246252, 0.099723, 0.986128, -0.979644, 0.242715, 0.433547, 0.199869, -0.572331, -0.152181, 0.329916, -0.071652, -0.580827, 0.88984, -0.857622, -0.926973, -0.444937, -0.183938, 0.72548, -0.238406, -0.651195, -0.770945, -0.97797, -0.666038, 0.253825, 0.001102, -0.769608, -0.364219, 0.653122, -0.845224, -0.900383, 0.916435, 0.562575, 0.577639, -0.655935, 0.683806, -0.955929, 0.271965, 0.670582, -0.874893, -0.671992, -0.124948, 0.354001, -0.289044, -0.880824, -0.505697, 0.975131, -0.404046, 0.345771, -0.013626, -0.077943, 0.837888, -0.371654, 0.453362, 0.331138, -0.360725, 0.125168, -0.964794, -0.826929, 0.794106, -0.982495, -0.861929, 0.451361, -0.023568, 0.112144, 0.738027, -0.664822, 0.441946, -0.163688, 0.893386, 0.808835, -0.80181, 0.418756, 0.622756, 0.034079, 0.345499, 0.181397, -0.723234, 0.696562, -0.961237, -0.03916, 0.261942, -0.234349, 0.962729, -0.185936, 0.185842, 0.763643, 0.167632, -0.850653, -0.155428, -0.983086, 0.018397, -0.211233, 0.864641, -0.751372, 0.463791, -0.823289, -0.290048, -0.073149, 0.533656, 0.163079, 0.49321, 0.864586, 0.339837, 0.992513, -0.057005, -0.363075, 0.789408, -0.949479, 0.327304, 0.457404, -0.623596, -0.602841, -0.674863, -0.566123, -0.04016, -0.527756, -0.988547, -0.581931, 0.854939, -0.076242, -0.818141, 0.402988, 0.959873, -0.603879, 0.533945, 0.806037, 0.563679, 0.309068, -0.794625, 0.517614, -0.495755, 0.508661, -0.767147, 0.606852, -0.246746, -0.40705, 0.052749, -0.467531, 0.686256, -0.88221, -0.176934, 0.447751, 0.053891, 0.565448, 0.439325, 0.056684, 0.727521, -0.551452, -0.25285, -0.239782, -0.678919, 0.941918, -0.552664, -0.866533, -0.833687, 0.578477, -0.236515, -0.645378, 0.051962, 0.493989, 0.828093, -0.302125, -0.440988, 0.026237, 0.982092, -0.048101, -0.755464, -0.37717, 0.47509, 0.653256, 0.832432, 0.855754, 0.360381, -0.17015, -0.728107, -0.784632, -0.631152, 0.924434, -0.703005, -0.06247, 0.266859, -0.41264, 0.647442, -0.850714, 0.610146, -0.925309, -0.192222, 0.85114, -0.787633, -0.27648, 0.389089, -0.549745, -0.375167, -0.8305, -0.175722, -0.703476, 0.689417, -0.45344, -0.077539, 0.51277, -0.137774, 0.509996, -0.43267, 0.093598, -0.232406, -0.083906, -0.485305, -0.361813, 0.144066, -0.043592, 0.424642, 0.986991, -0.575422, 0.108056, 0.130273, -0.295803, 0.963312, -0.708053, 0.7834, -0.878736, -0.826228, 0.795529, -0.042012, 0.68836, 0.513852, 0.454591, -0.727192, 0.28589, 0.394249, 0.719319, -0.53121, 0.203057, -0.74984, -0.435546, 0.46915, 0.176435, 0.303732, 0.801332, 0.827697, -0.183831, -0.1239, 0.990167, -0.007123, -0.090204, -0.802137, 0.63637, 0.752294, -0.682622, 0.571574, -0.821026, -0.44556, -0.737739, 0.833381, -0.700659, 0.407301, -0.108541, 0.863125, -0.221152, -0.790393, -0.958177, 0.020887, 0.816695, -0.457642, -0.004841, -0.631066, -0.073435, 0.147722, -0.325494, -0.174399, -0.496922, -0.779064, 0.689366, -0.713829, 0.126345, 0.888437, -0.823531, 0.075602, 0.316403, 0.653177, 0.733758, 0.403407, -0.296278, -0.994762, -0.945548, -0.964985, -0.952095, 0.630435, 0.564441, -0.145364, -0.729028, -0.274046, -0.961182, -0.922928, -0.310929, -0.926613, -0.349491, -0.241824, -0.674753, -0.20619, 0.320685, 0.533846, 0.856238, -0.775878, 0.251944, 0.169619, -0.56505, 0.389146, 0.981637, -0.006542, -0.234612, -0.753536, 0.77199, 0.325443, 0.840854, 0.174948, -0.979477, -0.485231, -0.783697, 0.684878, -0.939955, -0.922912, 0.453525, -0.012098, 0.431832, -0.985972, -0.05218, -0.645565, 0.999728, 0.242783, -0.100076, 0.343367, -0.548061, -0.534199, -0.546056, 0.816351, -0.761298, -0.787485, -0.757066, -0.83305, 0.800787, -0.394101, -0.096204, 0.173922, 0.81271, -0.919977, -0.819448, -0.337414, 0.268436, -0.323051, -0.679063, -0.00581, 0.391947, -0.590388, 0.510003, 0.01129, -0.170973, -0.324706, 0.001741, 0.244527, 0.212648, -0.511702, -0.933305, -0.607488, -0.316137, 0.715094, -0.961929, 0.135721, 0.782158, 0.547304, -0.298091, 0.780454, 0.308942, 0.105281, -0.344449, 0.935782, -0.631315, -0.949402, -0.705308, 0.999754, -0.645419, -0.266031, 0.76425, 0.585456, 0.928782, 0.607011, 0.270196, 0.905235, -0.858239, -0.195855, 0.305792, 0.584082, -0.210509, -0.173999, 0.824324, -0.74533, 0.696131, -0.641099, 0.707403, -0.568491, 0.64085, -0.577708, -0.780788, -0.737747, -0.339846, -0.431497, -0.907344, -0.298178, 0.669754, 0.715158, 0.890816, 0.877134, 0.419016, 0.022736, 0.997763, -0.258703, 0.509531, -0.102557, 0.409674, 0.019529, -0.36995, -0.985299, 0.327835, 0.981791, -0.207778, 0.48103, -0.125416, 0.3202, 0.958831, -0.516102, -0.572185, 0.679159, -0.764687, -0.955172, -0.469998, -0.557047, -0.532824, 0.703606, -0.579514, -0.015036, 0.147105, 0.028851, -0.347213, -0.019932, 0.15606, 0.993806, 0.894112, -0.99963, -0.620094, 0.215054, 0.496588, 0.084, -0.676355, -0.551419, -0.950723, -0.830096, 0.578957, 0.039835, 0.446344, 0.904247, -0.033941, -0.81856, -0.578186, 0.057856, -0.885668, 0.951545, 0.060842, -0.010294, 0.085369, 0.522728, 0.354027, -0.294758, 0.429752, 0.328914, 0.561625, 0.710191, 0.693355, 0.086036, -0.762908, -0.706465, -0.481285, -0.074891, -0.96047, -0.667613, -0.669066, -0.963166, 0.055655, -0.201263, -0.153725, -0.123261, 0.898545, 0.51319, -0.43631, 0.250236, -0.799261, 0.869664, 0.739559, 0.4021, -0.894646, 0.307303, 0.387991, -0.732365, -0.335351, 0.009052, 0.529916, 0.072033, 0.543984, 0.423317, -0.998256, 0.568293, 0.148305, -0.757981, 0.850728, 0.102901, -0.190797, -0.997457, 0.734182, -0.953924, 0.343012, -0.070544, 0.766336, 0.456754, 0.376048, -0.597014, -0.065209, -0.278378, -0.35889, -0.121898, -0.577598, -0.596985, 0.734414, 0.962736, -0.336725, 0.920892, -0.210088, -0.954281, -0.590088, -0.316314, 0.884465, -0.43125, 0.089128, 0.507989, 0.315806, -0.902086, -0.304593, 0.304133, -0.369196, 0.86179, 0.079252, 0.728694, 0.348416, -0.747251, -0.413221, 0.482729, -0.612558, -0.458825, -0.632263, -0.989215, -0.389053, -0.606369, -0.181894, 0.827312, 0.870601, -0.9856, 0.21473, -0.328364, -0.805487, 0.59506, -0.717725, 0.613022, -0.486902, -0.346448, -0.857551, -0.178259, -0.852572, -0.291459, 0.202821, -0.593399, 0.328959, -0.669342, 0.711407, 0.431166, 0.046969, -0.711472, 0.81955, -0.497522, 0.428023, -0.370867, -0.575357, -0.79154, 0.051436, 0.071935, -0.874042, 0.687667, 0.376745, 0.001103, -0.221096, -0.713609, -0.249726, 0.696809, -0.463919, -0.956152, 0.921492, 0.051743, 0.187907, 0.654332, 0.753417, 0.939616, -0.646714, -0.624903, 0.710668, 0.690062, -0.562926, 0.42977, -0.918019, 0.620161, -0.195706, -0.14817, -0.360041, 0.854987, 0.277203, 0.50889, -0.658715, 0.538804, 0.769241, -0.981708, 0.259073, 0.069941, 0.370966, 0.899523, -0.00579, -0.043348, 0.864144, -0.09708, -0.628859, 0.181087, 0.517733, 0.983056, -0.26079, -0.802774, 0.304272, 0.888787, 0.161273, 0.628118, 0.663029, 0.363542, 0.431043, -0.616303, -0.883195, 0.233033, -0.954338, 0.614977, 0.970322, 0.497869, 0.406102, -0.622701, 0.632102, 0.486736, -0.967365, 0.933694, -0.716667, -0.911851, -0.350433, 0.762935, -0.802107, 0.050819, -0.712459, -0.259422, 0.117084, 0.620313, -0.198907, -0.709825, 0.025051, 0.384125, 0.750688, 0.28824, 0.698855, 0.862429, -0.50643, 0.414703, 0.286667, -0.470255, 0.829836, 0.887914, 0.675373, 0.225466, -0.756888, 0.553497, 0.64819, -0.52851, -0.32858, -0.625153, 0.537321, -0.483682, -0.073723, 0.985251, -0.148753, -0.127375, -0.378964, -0.030468, -0.30716, -0.698805, -0.701457, -0.385274, -0.560848, -0.71119, 0.031465, 0.310515, -0.140853, 0.612563, 0.673827, -0.51118, -0.505356, 0.06278, -0.527185, 0.839937, 0.852363, -0.514123, -0.572813, -0.764201, -0.943209, 0.014288, 0.599129, 0.802254, -0.252392, -0.052557, -0.644723, -0.549447, 0.191711, -0.242638, -0.56279, -0.526064, 0.346034, -0.005556, 0.718985, -0.78946, -0.496133, 0.870892, -0.354525, 0.022894, 0.424526, 0.672151, -0.404306, 0.670724, 0.898511, 0.361963, 0.571205, 0.027766, -0.876006, 0.570736, -0.015329, -0.81362, -0.090709, -0.258103, -0.891695, -0.805445, -0.915697, 0.079103, -0.55349, 0.159306, 0.899196, 0.476916, 0.211369, -0.169569, 0.358602, -0.079723, -0.189892, -0.65019, -0.491215, 0.7682, -0.317483, -0.993848, 0.669241, -0.787503, -0.192175, 0.618152, 0.636964, 0.178092, -0.127657, -0.683083, -0.696914, 0.149576, 0.161589, 0.738768, -0.840285, -0.232935, -0.294932, 0.36209, -0.93838, -0.80207, 0.947688, -0.907391, -0.297309, 0.286899, -0.82987, 0.007642, 0.986445, 0.578582, 0.124038, 0.252478, 0.128255, 0.106001, -0.833099, 0.691718, -0.321365, 0.999563, 0.240999, 0.297526, 0.277837, 0.305819, 0.550701, 0.974198, -0.489469, -0.940198, 0.14797, -0.893833, -0.248261, -0.788778, -0.687953, -0.194255, 0.596787, -0.406853, -0.998092, 0.312146, 0.075569, -0.974178, -0.238176, 0.658012, 0.887835, -0.193192, 0.237335, 0.859391, 0.530296, 0.455379, -0.380185, -0.372228, -0.391174, -0.534258, 0.310863, -0.886344, -0.219225, -0.803269, 0.360038, -0.664033, -0.696736, -0.148953, -0.014585, -0.185184, 0.83197, 0.104067, -0.833771, 0.308997, 0.982954, 0.334785, -0.971828, -0.901457, -0.405818, 0.68634, -0.545575, 0.404335, -0.005298, -0.088477, 0.404121, -0.46232, -0.616236, 0.445434, 0.125554, 0.592681, 0.472363, 0.01305, -0.792563, 0.259799, -0.271005, 0.846658, -0.984815, -0.42455, -0.978974, -0.82488, 0.650264, 0.695711, -0.823603, 0.823967, -0.41644, -0.66252, 0.631374, 0.517189, -0.344358, 0.187619, -0.945095, 0.824322, -0.421384, 0.61209, 0.229955, 0.041244, 0.394523, 0.683063, -0.395756, 0.471622, -0.884357, 0.097838, -0.82519, -0.320813, 0.69302, 0.891095, 0.182914, -0.56144, -0.318588, -0.167825, -0.377383, 0.718625, -0.547263, 0.212234, -0.828581, -0.434112, 0.901291, -0.718005, 0.767813, 0.293906, -0.791135, -0.775422, 0.678801, 0.008292, -0.956202, -0.036669, -0.782373, 0.232434, -0.034205, -0.284468, -0.380934, 0.277344, 0.348308, -0.291633, 0.154462, -0.313836, 0.709294, -0.811373, -0.162151, 0.577694, -0.236311, -0.493761, -0.011407, 0.181235, 0.057353, 0.935998, -0.271654, -0.412665, -0.605239, 0.047534, -0.785936, -0.134379, 0.16929, -0.320478, 0.331447, -0.366547, -0.885081, -0.145766, 0.672201, -0.978322, -0.782594, 0.545668, 0.278188, -0.009337, 0.303893, 0.056986, 0.136853, -0.982006, 0.875127, 0.838514, -0.484277, 0.690164, 0.906798, 0.699353, -0.646524, 0.587198, -0.036712, 0.697469, -0.192294, -0.47675, -0.066584, -0.428336, 0.008296, -0.003937, 0.851017, 0.602593, 0.693245, -0.304544, -0.948702, -0.989402, -0.287768, -0.89624, 0.998436, -0.988795, 0.016839, 0.865289, -0.020532, 0.727147, -0.385366, 0.659807, -0.922784, -0.70638, 0.881226, -0.167937, -0.645283, -0.882758, 0.950785, 0.04042, -0.508889, 0.845175, -0.828986, -0.243562, -0.081933, -0.044454, -0.348817, -0.699382, 0.785413, -0.191813, -0.698506, -0.36995, 0.202573, 0.175998, -0.654399, 0.316358, 0.718492, 0.574396, -0.694245, 0.773063, -0.777825, -0.278803, 0.269655, -0.30637, -0.295469, -0.144409, 0.222357, -0.599856, 0.170943, -0.910277, -0.123035, 0.261113, -0.661285, 0.30834, 0.903913, 0.930748, -0.204934, 0.147356, -0.595736, -0.553997, 0.921707, 0.221562, -0.516869, -0.949071, -0.060963, -0.790402, 0.164886, -0.518271, -0.822681, -0.241062, -0.672094, 0.38658], \"shape\": [24, 24, 2]}, \"weights\": [{\"data\": [0.243127, -0.273576, 0.142534, 0.382355, 0.240699, 0.221264, -0.204652, 0.025516, -0.326235, 0.311959, 0.349405, -0.24348, -0.262766, -0.041615, -0.27108, -0.297989, 0.48268, 0.480729, 0.234804, -0.090695, 0.118811, -0.420773, -0.10074, 0.105421, -0.049513, -0.008734, -0.135492, -0.210973, 0.495209, 0.316778, -0.23497, -0.141953, 0.169686, 0.425686, -0.481719, 0.336174, -0.296247, 0.057504, 0.385775, -0.314525, -0.142486, 0.04128, -0.263482, -0.289508, 0.024482, 0.148187, -0.251623, -0.477775, -0.379829, -0.074373, 0.263996, 0.209771, -0.300583, -0.123236, 0.305783, -0.239945, -0.398339, 0.422568, -0.464506, 0.040658, -0.482764, 0.032338, 0.343604, -0.390843, 0.278262, -0.147314, 0.171734, -0.346697, -0.432034, 0.261471, -0.427296, 0.477033, 0.176231, 0.202136, 0.467997, 0.003032, -0.307163, -0.475624, -0.487272, -0.490661, -0.262228, -0.176588, -0.141941, 0.135036, 0.168167, -0.264522, 0.440257, -0.331517, -0.35466, -0.34618], \"shape\": [3, 3, 2, 5]}, {\"data\": [0.04825, 0.297221, -0.493891, 0.215661, 0.033714], \"shape\": [5]}, {\"data\": [0.114003, 0.42974, -0.24509, 0.116435, -0.151984], \"shape\": [5]}, {\"data\": [0.11488, -0.335425, -0.199009, -0.226551, 0.295127], \"shape\": [5]}, {\"data\": [-0.105744, -0.324408, -0.427294, -0.308119, -0.100196], \"shape\": [5]}, {\"data\": [0.32784, 0.19287, 0.313256, 0.056091, 0.404014], \"shape\": [5]}, {\"data\": [-0.473271, 0.292796, -0.247635, 0.297266, -0.192785, 0.062332, 0.145304, 0.008041, -0.100871, -0.240166, 0.043534, -0.104421, 0.297577, -0.114636, 0.151038, -0.275458, -0.013338, -0.328997, -0.096385, 0.152099, 0.367538, -0.225103, 0.337793, -0.414864, -0.350637, 0.001185, 0.376284, 0.266598, 0.288587, 0.468407, 0.241278, 0.4996, 0.358792, -0.174562, 0.022563, 0.329304, -0.364833, -0.001661, 0.399071, -0.090917, -0.446037, -0.295069, -0.246901, 0.003529, -0.389, 0.44402, 0.34541, 0.184254, -0.46005, -0.406378, -0.02072, -0.14979, -0.352874, 0.254629, -0.37191, 0.056173, -0.365722, 0.187195, 0.35439, -0.468789, -0.344897, -0.071651, -0.010362, -0.04351, -0.417358, 0.15781, -0.411343, 0.088304, -0.354495, 0.281837, 0.144887, -0.02568, -0.140164, -0.185076, 0.377982, 0.305902, -0.419316, 0.194607, -0.348783, 0.212065, -0.299831, 0.405302, -0.158914, 0.08631, 0.018465, -0.280433, -0.343198, -0.265969, -0.278476, 0.100214, -0.25613, -0.166308, 0.132484, 0.343271, 0.10101, -0.189532, -0.074373, -0.257668, 0.284859, -0.143125, 0.45224, -0.097783, -0.238382, 0.073706, -0.267699, -0.16844, 0.030676, -0.4128, -0.232788, 0.025011, 0.464291, -0.354553, 0.322224, 0.055424, -0.197593, -0.055373, 0.161844, -0.060427, 0.46882, 0.468982, 0.091827, 0.233269, -0.009598, 0.236038, 0.47551, 0.070679, 0.276132, -0.355512, -0.485245, -0.125034, 0.370703, -0.098497, -0.227469, 0.345476, 0.373965, 0.22483, -0.439445, -0.017126, -0.211873, -0.435961, -0.334965, -0.116569, 0.373287, -0.461146, -0.141018, 0.377399, 0.02581, -0.489318, 0.124251, -0.227303, -0.437978, -0.117803, 0.344675, 0.123827, -0.305288, 0.294888, -0.194257, 0.296227, -0.235852, -0.105786, 0.188984, -0.26551, 0.485509, -0.438162, 0.249158, 0.435006, -0.481258, -0.41004, 0.329017, -0.439928, 0.320508, -0.012216, 0.484782, 0.420401, 0.448519, -0.085027, 0.474229, -0.175292, 0.110881, -0.165325], \"shape\": [3, 3, 5, 4]}, {\"data\": [0.057039, -0.444829, -0.236013, 0.359404], \"shape\": [4]}, {\"data\": [-0.268201, 0.202212, -0.169172, -0.409066], \"shape\": [4]}, {\"data\": [0.127511, -0.360623, 0.117668, 0.14835], \"shape\": [4]}, {\"data\": [0.338636, 0.20719, 0.282811, 0.179391], \"shape\": [4]}, {\"data\": [0.056268, 0.460227, 0.236507, 0.329529], \"shape\": [4]}, {\"data\": [-0.419033, 0.444903, 0.251663, -0.020549, -0.343135, -0.000358, -0.130653, 0.046716, -0.352174, 0.091368, 0.013803, 0.062827, -0.071645, -0.172493, -0.053313, -0.075602, -0.105103, -0.324598, -0.12081, 0.275434, -0.207741, -0.209065, 0.40152, -0.011041, 0.303822, -0.24936, 0.435131, 0.335644, -0.462446, 0.370158, 0.022012, -0.329608, 0.317906, -0.455958, 0.424681, -0.120852, 0.164718, -0.37187, -0.409077, 0.476856, 0.36936, -0.489961, -0.444037, -0.015922, 0.413574, -0.386358, -0.418659, 0.007538, 0.118804, 0.205877, -0.184511, -0.347444, -0.223924, -0.307242, 0.365172, 0.31884, -0.462891, -0.273065, 0.345436, 0.464124, 0.047306, 0.26701, 0.431323, 0.32155, 0.153772, -0.219345, 0.327233, -0.337168, -0.07331, 0.229063, -0.330038, -0.277947, -0.054019, -0.221511, 0.316302, -0.48675, 0.173257, 0.261652, 0.406257, -0.062738, 0.10078, 0.070205, -0.455131, 0.416173, -0.223881, 0.197124, 0.274205, -0.250864, 0.343497, -0.084901, -0.371909, 0.031686, -0.287007, -0.077727, -0.402794, -0.173526, -0.35086, -0.360869, 0.07674, -0.472229, -0.160609, -0.223205, -0.233559, -0.49328, -0.096505, -0.318987, -0.01889, -0.484727], \"shape\": [3, 3, 4, 3]}, {\"data\": [-0.176081, -0.382328, -0.494196], \"shape\": [3]}, {\"data\": [0.258953, -0.333269, 0.189332], \"shape\": [3]}, {\"data\": [0.200279, 0.371936, 0.218567], \"shape\": [3]}, {\"data\": [-0.363197, 0.480702, -0.176325], \"shape\": [3]}, {\"data\": [0.457035, 0.315036, 0.254467], \"shape\": [3]}, {\"data\": [0.147691, 0.496914, 0.018803, 0.158113, 0.099063, 0.253067, -0.363753, -0.495883, -0.350491, 0.198439, 0.093353, 0.399915, -0.055543, -0.183215, 0.423082, -0.034138, 0.298365, -0.300841, 0.314519, -0.356525, 0.183485, -0.443384, 0.283675, 0.236567, 0.270444, -0.313324, -0.450025, 0.389981, -0.326327, 0.273179, -0.21656, 0.155967, 0.489166, -0.226211, -0.081724, 0.274681, -0.242547, -0.44576, 0.364714, -0.243047, -0.097732, -0.191869, 0.471512, 0.076365, -0.23072, 0.372062, -0.421964, 0.267839, 0.141674, -0.305882, 0.244875, 0.456319, 0.252493, 0.170026, 0.094447, -0.310152, -0.072836, 0.31242, 0.258825, 0.210387, -0.396797, 0.335181, -0.001955, 0.042642, -0.004302, -0.03489, -0.405799, 0.372981, -0.33029, -0.148623, -0.308443, 0.027218, 0.405578, -0.223023, 0.225923, 0.277701, -0.488372, 0.347127, 0.211255, 0.179234, -0.274274, 0.058895, 0.48563, -0.265001, 0.301342, -0.39318, 0.196567, -0.358702, -0.212521, 0.475099, 0.471225, -0.35201, 0.453757, 0.354102, 0.462529, -0.140548, -0.276937, 0.487544, -0.039953, 0.494679, 0.383687, -0.030248, 0.127146, 0.022552, -0.141038, 0.289651, 0.424487, 0.398849], \"shape\": [3, 3, 3, 4]}, {\"data\": [0.102249, 0.115466, -0.161441, -0.026659], \"shape\": [4]}, {\"data\": [-0.148353, 0.340733, 0.455803, -0.313422], \"shape\": [4]}, {\"data\": [-0.390497, 0.102486, 0.429953, -0.424197], \"shape\": [4]}, {\"data\": [0.220722, -0.380421, -0.117344, 0.104359], \"shape\": [4]}, {\"data\": [0.02052, 0.204885, 0.294357, 0.449967], \"shape\": [4]}, {\"data\": [-0.044936, -0.105153, -0.277222, 0.116398, 0.458289, 0.274036, 0.278788, -0.118609, -0.210667, -0.300068, -0.440616, 0.035709, -0.44508, 0.164255, -0.264186, 0.42687, -0.231821, -0.346216, 0.240705, 0.418461, 0.413135, -0.283782, -0.024648, 0.096252, -0.336619, 0.078267, 0.012915, -0.428768, 0.365644, 0.426793, 0.119492, -0.277818, -0.193463, -0.000176, -0.20853, -0.293156, 0.089983, 0.415963, 0.015888, 0.005846, 0.083741, -0.387495, 0.276987, 0.377448, -0.348197, 0.256929, 0.294997, -0.075105, 0.206232, -0.237966, -0.28072, 0.042993, 0.422321, 0.187853, 0.374486, -0.215395, 0.348649, 0.199744, 0.251145, 0.471717, -0.309747, 0.1591, 0.329584, -0.019603, -0.405238, 0.345153, 0.010736, -0.224268, -0.080378, 0.152436, -0.327253, 0.205598], \"shape\": [3, 3, 4, 2]}, {\"data\": [-0.498982, -0.243671], \"shape\": [2]}, {\"data\": [-0.072718, 0.05936], \"shape\": [2]}, {\"data\": [-0.013067, 0.087355], \"shape\": [2]}, {\"data\": [0.30588, -0.045016], \"shape\": [2]}, {\"data\": [0.00633, 0.372032], \"shape\": [2]}], \"expected\": {\"data\": [0.246734, 0.388287], \"shape\": [1, 1, 2]}}}\n"
     ]
    }
   ],
   "source": [
    "print(json.dumps(DATA))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
